home *** CD-ROM | disk | FTP | other *** search
- function pickup(newname)
- {
- currentitem[4] = items[newname][0];
- currentitem[5] = items[newname][1];
- currentitem[6] = items[newname][2];
- currentitem[7] = items[newname][3];
- if(currentitem[1] != false)
- {
- items[newname][0] = currentitem[0];
- items[newname][1] = currentitem[1];
- items[newname][2] = currentitem[2];
- items[newname][3] = currentitem[3];
- _root["item" + newname].attachMovie(items[newname][1],"inside",1);
- }
- else
- {
- _root.score += 1;
- items[newname][0] = false;
- items[newname][1] = false;
- items[newname][2] = false;
- items[newname][3] = false;
- _root["item" + newname].inside.removeMovieClip();
- }
- currentitem.shift();
- currentitem.shift();
- currentitem.shift();
- currentitem.shift();
- item = "carrying " + _root.currentitem[0];
- }
- function endcheck()
- {
- if(reallife <= 0)
- {
- life = 0;
- if(canmove)
- {
- hero.gotoAndStop("death");
- _root.canmove = false;
- }
- }
- }
- function saveinit()
- {
- first = true;
- phonechance = true;
- hero._visible = 1;
- life = Math.round(reallife);
- }
- function init()
- {
- initarrays();
- ememies = 0;
- phatnum = 0;
- doornum = 0;
- canmove = true;
- scene = 1;
- herocolor = new Color(hero);
- hero.high = 65;
- distance = - dis;
- getUrl("FSCommand:allowscale", "false");
- getUrl("FSCommand:fullscreen", "true");
- currentitem = new Array();
- removeitem();
- item = "carrying " + _root.currentitem[0];
- reallife = 100;
- score = 0;
- stageleft = 8;
- stageright = 660;
- stagetop = 49;
- stagebottom = 437;
- hero.h_width = 12;
- downspeed = 1;
- originalupspeed = 20;
- upspeed = originalupspeed;
- gravity = 2;
- speed = 4;
- saveinit();
- }
- function scenechange(doornum)
- {
- newdoor = doors[doornum][1];
- distance = doors[doornum][2];
- gotoAndPlay(doors[doornum][0]);
- }
- function remove_swarm()
- {
- if(swarmarray[scene][0] == "alien")
- {
- alien.removeMovieClip();
- }
- else
- {
- sw = 2;
- while(sw >= 0)
- {
- _root["swarm" + sw].removeMovieClip();
- sw--;
- }
- }
- }
- function removeitem()
- {
- currentitem[0] = "nothing";
- currentitem[1] = false;
- currentitem[2] = false;
- currentitem[3] = false;
- item = "carrying " + _root.currentitem[0];
- }
- function initscene()
- {
- phatman1.removeMovieClip();
- if(swarmarray[scene][0] == "alien")
- {
- if(swarmarray[scene][3] == "prof")
- {
- _root.attachMovie("professor","alien",200 + s);
- }
- else
- {
- _root.attachMovie("alien","alien",200 + s);
- }
- _root.alien._xscale = 100;
- _root.alien._yscale = 100;
- _root.alien._x = _root.swarmarray[scene][1];
- _root.alien._y = _root.swarmarray[scene][2];
- }
- else
- {
- top = swarmarray[scene][0];
- top = checknumber(top);
- s = top;
- while(s > 0)
- {
- _root.attachMovie("swarmer","swarm" + s,200 + s);
- _root["swarm" + s]._x = _root.swarmarray[scene][1];
- _root["swarm" + s]._y = _root.swarmarray[scene][2];
- s--;
- }
- }
- if(first)
- {
- delete first;
- if(saved)
- {
- hero._x = _root["asavephone" + phonenumber]._x;
- hero._y = _root["asavephone" + phonenumber]._y;
- delete saved;
- }
- else
- {
- hero._x = 350;
- hero._y = 10;
- }
- }
- else
- {
- hero._x = _root["door" + newdoor]._x + distance;
- hero._y = _root["door" + newdoor]._y - 10;
- }
- hero.x = hero._x;
- place = "you are " + sceneword[scene];
- updoing = false;
- maxwall = 1;
- }
- function findvariables(name)
- {
- _root[name].miny = Math.round(_root[name]._y - _root[name]._height / 2);
- _root[name].maxy = Math.round(_root[name]._y + _root[name]._height / 2);
- _root[name].minx = Math.round(_root[name]._x - _root[name]._width / 2);
- _root[name].maxx = Math.round(_root[name]._x + _root[name]._width / 2);
- }
- function walk()
- {
- if(runtime > 20)
- {
- if(downmove)
- {
- speed = 6;
- }
- else
- {
- speed = 7;
- }
- }
- else
- {
- speed = 4;
- }
- maptest("hero");
- if(Key.isDown(32))
- {
- if(notfired && currentitem[2])
- {
- fire_weapon();
- notfired = false;
- }
- }
- else
- {
- notfired = true;
- }
- if(canmove)
- {
- if(Key.isDown(37))
- {
- runtime++;
- if(speed == 4)
- {
- hero.frame = "run";
- }
- else
- {
- hero.frame = "fastrun";
- }
- hero.x -= speed;
- hero._xscale = -50;
- }
- else if(Key.isDown(39))
- {
- runtime++;
- if(speed == 4)
- {
- hero.frame = "run";
- }
- else
- {
- hero.frame = "fastrun";
- }
- hero.x += speed;
- hero._xscale = 50;
- }
- else
- {
- runtime = 0;
- hero.frame = "stand";
- }
- }
- if(hero.miny > hero._y)
- {
- downmove = true;
- }
- else
- {
- downmove = false;
- }
- hero.y = hero._y;
- if((Key.isDown(38) && downmove == false || Key.isDown(38) && updoing) && canmove)
- {
- moveup();
- hero.frame = "jumping";
- }
- else if(downmove)
- {
- hero.frame = "landing";
- movedown();
- }
- else
- {
- upspeed = originalupspeed;
- }
- if(hero.x < hero.minx)
- {
- hero.x = hero.minx;
- if(hero.frame == "run" || hero.frame == "fastrun")
- {
- hero.frame = "stand";
- }
- }
- else if(hero.x > hero.maxx)
- {
- hero.x = hero.maxx;
- if(hero.frame == "run" || hero.frame == "fastrun")
- {
- hero.frame = "stand";
- }
- }
- hero._y = hero.y;
- if(canmove)
- {
- hero.x += hero.xchange;
- hero.xchange = 0;
- hero._x = hero.x;
- hero.gotoAndStop(hero.frame);
- }
- }
- function moveup()
- {
- updoing = true;
- downspeed = 1;
- hero.y -= upspeed;
- upspeed -= gravity;
- if(upspeed < 1)
- {
- updoing = false;
- upspeed = originalupspeed;
- }
- else if(hero.y < hero.maxy)
- {
- hero.y = hero.maxy;
- updoing = false;
- upspeed = originalupspeed;
- }
- }
- function movedown()
- {
- updoing = false;
- hero.y += downspeed;
- downspeed += gravity;
- if(hero.y >= hero.miny)
- {
- hero.frame = "landed";
- hero.y = hero.miny;
- downspeed = 1;
- upspeed = originalupspeed;
- }
- }
- function maptest(name)
- {
- _root[name].miny = stagebottom;
- _root[name].maxy = stagetop;
- _root[name].minx = stageleft;
- _root[name].maxx = stageright;
- top = maxwall + 1;
- top = checknumber(top);
- i = 1;
- while(i < top)
- {
- if(_root[name]._x + _root[name].h_width / 2 > _root["wall" + i].minx && _root[name]._x - _root[name].h_width / 2 < _root["wall" + i].maxx)
- {
- if(_root[name]._y <= _root["wall" + i].miny && _root["wall" + i].miny < _root[name].miny)
- {
- _root[name].miny = _root["wall" + i].miny;
- }
- else if(_root[name]._y - _root[name].high >= _root["wall" + i].maxy && _root["wall" + i].maxy > _root[name].maxy)
- {
- _root[name].maxy = _root["wall" + i].maxy + _root[name].high;
- }
- }
- if(_root[name]._y > _root["wall" + i].miny && _root[name]._y - _root[name].high < _root["wall" + i].maxy)
- {
- if(_root[name]._x <= _root["wall" + i]._x && _root["wall" + i].minx < _root[name].maxx)
- {
- _root[name].maxx = _root["wall" + i].minx - _root[name].h_width;
- }
- else if(_root[name]._x >= _root["wall" + i]._x && _root["wall" + i].maxx > _root[name].minx)
- {
- _root[name].minx = _root["wall" + i].maxx + _root[name].h_width;
- }
- }
- i++;
- }
- }
- function checknumber(name)
- {
- if(name < 100)
- {
- return name;
- }
- return 3;
- }
- getUrl("FSCommand:showmenu", "false");
- initphatmen22 = function()
- {
- i = 1;
- while(i <= phatnum)
- {
- _root["p" + i]._visible = 1;
- i++;
- }
- i = phatnum + 1;
- while(i <= 5)
- {
- _root["p" + i]._visible = 0;
- i++;
- }
- if(phatnum == 5)
- {
- doors[122][3] = false;
- }
- };
- fire_weapon = function()
- {
- bulletnum = currentitem[3];
- if(bulletnum < 3)
- {
- d = 1;
- while(d <= 3)
- {
- _root.attachMovie("bullet","bullet" + d,d);
- _root["bullet" + d]._x = hero._x;
- _root["bullet" + d]._y = hero._y - 40;
- d++;
- }
- if(bulletnum == 1)
- {
- bulletnum = 1;
- bullet1.x = -1;
- bullet1.y = 0;
- bullet2.x = 0;
- bullet2.y = -1;
- bullet3.x = 1;
- bullet3.y = 0;
- }
- else if(bulletnum == 2)
- {
- bulletnum = 2;
- bullet1.x = -0.5;
- bullet1.y = 0.5;
- bullet2.x = 0.5;
- bullet2.y = -0.5;
- bullet3.x = 0.5;
- bullet3.y = 0.5;
- }
- }
- else
- {
- d = 1;
- _root.attachMovie("bullet","bullet" + d,d);
- _root["bullet" + d]._x = hero._x;
- _root["bullet" + d]._y = hero._y - 40;
- }
- removeitem();
- };
- init();
-